package 每日练习;

import java.util.Scanner;
public class text22 {
    public static void main(String[] args) {
        System.out.println("请输入评委数量:");
        Scanner sc = new Scanner(System.in);
        int number = sc.nextInt();
        System.out.println(ret(number));
    }
    public static double ret(int number){
        int i = 0;
        double[] arr = new double[number];
        Scanner sc = new Scanner(System.in);
        for(i = 0;i <number;i++ )
        {
            System.out.println("请输入第"+(i+1)+"个评委的分数");
            double a = sc.nextDouble();
            arr[i] = a;
        }
        double sum = 0;
        double max = arr[0];
        double min = arr[0];
        for (i = 0; i <arr.length ; i++)
        {
            double num = arr[i];
            sum += num;
            if(num > max)
                max = num;
            if(num < min)
                min = num;
        }
        return (sum - max - min) / (number - 2);
    }
}
